package org.xxpay.pay.channel.ysepay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

@Component
public class YsepayConfig {

    public static final String CHARSET = "utf-8";

    // 接口请求地址
    public static final String API_URL = "https://openapi.ysepay.com/gateway.do";
    // 代付地址
    public static final  String AGENTPAY_URL= "https://df.ysepay.com/gateway.do";
    // 代付查询地址
    public static final String AGENTPAY_QUERY_URL= "https://searchdf.ysepay.com/gateway.do";
    // 分账请求地址
    public static final String DIVISION_REQ_URL= "https://commonapi.ysepay.com/gateway.do";

    // 渠道名称:银盛支付
    public final static String CHANNEL_NAME_YSEPAY = "ysepay";

    public final static String PAY_CHANNEL_YSEPAY_B2C = "ysepay_b2c"; //网银支付
    public final static String PAY_CHANNEL_YSEPAY_PC = "ysepay_pc"; //快捷支付pc
    public final static String PAY_CHANNEL_YSEPAY_WAP = "ysepay_wap"; //快捷支付wap
    public final static String PAY_CHANNEL_YSEPAY_WXPAY_QR = "ysepay_wxpay_qr"; //微信扫码支付
    public final static String PAY_CHANNEL_YSEPAY_ALIPAY_QR = "ysepay_alipay_qr"; //支付宝扫码支付


    // 商户号
    private String sellerId;
    // 商户名称
    private String sellerName;
    // 业务代码
    private String businessCode;
    // 商户私钥证书路径
    private String privatePfxPath;
    // 证书密码
    private String pfxPwd;
    // 银盛公钥证书路径
    private String publicCerPath;
    // 银盛代付账户号（用于代付余额查询）
    private String agentpayAccountId;

    // 分账用户商户号
    private String divisionSellerId;
    // 分账用户商户私钥证书路径
    private String divisionPrivatePfxPath;
    // 分账用户证书密码
    private String divisionPfxPwd;
    // 分账用户银盛公钥证书路径
    private String divisionPublicCerPath;




    public YsepayConfig(){}

    public YsepayConfig(String payParam) {
        Assert.notNull(payParam, "init gomepay config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.sellerId = object.getString("sellerId");
        this.sellerName = object.getString("sellerName");
        this.businessCode = object.getString("businessCode");
        this.privatePfxPath = object.getString("privatePfxPath");
        this.pfxPwd = object.getString("pfxPwd");
        this.publicCerPath = object.getString("publicCerPath");
        this.agentpayAccountId = object.getString("agentpayAccountId");
        this.divisionSellerId = object.getString("divisionSellerId");
        this.divisionPrivatePfxPath = object.getString("divisionPrivatePfxPath");
        this.divisionPfxPwd = object.getString("divisionPfxPwd");
        this.divisionPublicCerPath = object.getString("divisionPublicCerPath");
    }

    public String getSellerId() {
        return sellerId;
    }

    public void setSellerId(String sellerId) {
        this.sellerId = sellerId;
    }

    public String getSellerName() {
        return sellerName;
    }

    public void setSellerName(String sellerName) {
        this.sellerName = sellerName;
    }

    public String getBusinessCode() {
        return businessCode;
    }

    public void setBusinessCode(String businessCode) {
        this.businessCode = businessCode;
    }

    public String getPrivatePfxPath() {
        return privatePfxPath;
    }

    public void setPrivatePfxPath(String privatePfxPath) {
        this.privatePfxPath = privatePfxPath;
    }

    public String getPfxPwd() {
        return pfxPwd;
    }

    public void setPfxPwd(String pfxPwd) {
        this.pfxPwd = pfxPwd;
    }

    public String getPublicCerPath() {
        return publicCerPath;
    }

    public void setPublicCerPath(String publicCerPath) {
        this.publicCerPath = publicCerPath;
    }

    public String getAgentpayAccountId() {
        return agentpayAccountId;
    }

    public void setAgentpayAccountId(String agentpayAccountId) {
        this.agentpayAccountId = agentpayAccountId;
    }

    public String getDivisionSellerId() {
        return divisionSellerId;
    }

    public void setDivisionSellerId(String divisionSellerId) {
        this.divisionSellerId = divisionSellerId;
    }

    public String getDivisionPrivatePfxPath() {
        return divisionPrivatePfxPath;
    }

    public void setDivisionPrivatePfxPath(String divisionPrivatePfxPath) {
        this.divisionPrivatePfxPath = divisionPrivatePfxPath;
    }

    public String getDivisionPfxPwd() {
        return divisionPfxPwd;
    }

    public void setDivisionPfxPwd(String divisionPfxPwd) {
        this.divisionPfxPwd = divisionPfxPwd;
    }

    public String getDivisionPublicCerPath() {
        return divisionPublicCerPath;
    }

    public void setDivisionPublicCerPath(String divisionPublicCerPath) {
        this.divisionPublicCerPath = divisionPublicCerPath;
    }
}
